import request from "./request"

// 发布旅游圈
export function publishBlog(userId,content,article,files,liked){
    return request({
      method: 'POST',
      url: '/userBlog/publishBlog',
      data:{
          userId,
          content,
          article,
          files,
          liked
      }
    })
}
export function publishBlogImage(files){
    console.log(files);  
    return request({
      method: 'POST',
      url: '/userBlog/publishBlogImage',
      data:{
        files
      },
      headers:{
        'Content-Type':'multipart/form-data'
      }
    })
}
// 获取所有旅游圈
export function getBlog(pageNum=1,pageSize=20 ){
    return request({
        method: 'GET',
        url: '/userBlog/getAllUserBlog',
        params:{
            pageNum,
            pageSize 
        }
        })
}
// 获取文章详细信息
export function getBlogDetail(articleId){
    return request({
        method: 'GET',
        url: `/userBlog/getBlogById/${articleId}`
        })
}

// 为文章点赞
export function addLiked(articleId){
  return request({
    method: 'GET',
    url: `/userBlog/addLiked/${articleId}`
    })
}

// 发布评论
export function publishComment(comment){
  return request({
    method: 'POST',
    url: `/comment/publishComment`,
    data: comment
    })
}

// 获取评论
export function getComment(articleId){
  return request({
      method: 'GET',
      url: `/comment/getArticleComment`,
      params:{
        articleId
      }
    })
}

// 删除评论
export function deleteComment(commentId){
  return request({
      method: 'GET',
      url: `/comment/deleteAricleComment`,
      params:{
        commentId
      }
    })
}

// 获取热门推荐
export function getHotRecommendation(){
  return request({
    method: 'GET',
    url: `/route/selectHotRoute`,
    })
}